package com.d2rv.offscreen;

import com.d2rv.guide.GoalManager;
import com.d2rv.model.CityModelManager;
import com.d2rv.user.UserManager;
import processing.core.PApplet;

/**
 * This class is the manager of the offscreen guide.
 *
 * @author Darrieutort A., Dupouy A., Rossignol L., Van Poucke A.
 */
public class OffScreenGuideManager {

    private OffScreenGuideGUI offscreenguidegui;
    private OffScreenGuideMap offscreenguidemap;

    /**
     * Default constructor.
     *
     * @param parent the current application
     * @param usermanager the manager of the user
     * @param citymodelmanager the manager of the city model
     * @param goalmanager the manager of the goal
     */
    public OffScreenGuideManager(PApplet parent, UserManager usermanager, CityModelManager citymodelmanager, GoalManager goalmanager) {
        this.offscreenguidegui = new OffScreenGuideGUI(parent, parent.width / 8, parent.height);
        this.offscreenguidemap = new OffScreenGuideMap(parent, parent.width / 2 - parent.width / 8, parent.height, false, 0,
                usermanager, citymodelmanager, goalmanager);
    }

    /**
     * Calls the draw method of the offscreen guide GUI and offscreen guide map.
     */
    public void draw() {
        this.offscreenguidegui.draw();
        this.offscreenguidemap.draw();
    }

    /**
     *
     * @param parent the current application
     */
    public void show(PApplet parent) {
        this.offscreenguidegui.show(parent, 0, 0);
        this.offscreenguidemap.show(parent, 0 + offscreenguidegui.width, 0);
    }

    /**
     * Sets the zoom value of the camera with the new value
     *
     * @param zoom the new zoom value
     */
    public void updateZoomCameraGuide(float zoom) {
        this.offscreenguidemap.updateCameraZoom(zoom);
    }

    /**
     *
     * @return zoom of the camera for the guide map.
     */
    public float zoomCameraGuide() {
        return this.offscreenguidemap.zoomCamera();
    }

    /**
     * Returns the offscreen guide gui.
     *
     * @return the offscreen guide gui
     */
    public OffScreenGuideGUI offscreenguidegui() {
        return this.offscreenguidegui;
    }
}